<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FEUP-Defender: nave_feup.c Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Gerado por Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "../../search",false,'Localizar');
--></script>
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='../../open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='../../closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='../../closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="../../index.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="../../modules.html"><span>Módulos</span></a></li>
      <li><a href="../../annotated.html"><span>Estruturas&nbsp;de&nbsp;dados</span></a></li>
      <li class="current"><a href="../../files.html"><span>Ficheiros</span></a></li>
      <li><a href="../../dirs.html"><span>Directories</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="../../search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Localizar" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="../../files.html"><span>Lista&nbsp;de&nbsp;ficheiros</span></a></li>
      <li><a href="../../globals.html"><span>Globais</span></a></li>
    </ul>
  </div>
<h1>nave_feup.c</h1><a href="../../d8/da6/nave__feup_8c.html">Ir para a documentação deste ficheiro.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="../../db/d0a/pixmap__nave__feup_8h.html">pixmaps\pixmap_nave_feup.h</a>&quot;</span>
<a name="l00002"></a>00002 
<a name="l00003"></a><a class="code" href="../../d8/da6/nave__feup_8c.html#aaec4fe8fbe90127a59ce69a5577ab30e">00003</a> <a class="code" href="../../da/d3a/structSprite.html">Sprite</a> *<a class="code" href="../../d8/da6/nave__feup_8c.html#aaec4fe8fbe90127a59ce69a5577ab30e">cria_nave</a>(<span class="keywordtype">char</span>* video_base)
<a name="l00004"></a>00004 {
<a name="l00005"></a>00005         <a class="code" href="../../da/d3a/structSprite.html">Sprite</a>* aero_nave = <a class="code" href="../../d4/d18/group__sprite.html#gac732cca247655c1bac63318eb29ffe7f">create_sprite</a>(<a class="code" href="../../db/d0a/pixmap__nave__feup_8h.html#adc08029b3f035d18866188825b3388d8">nave_feup</a>);
<a name="l00006"></a>00006         aero_nave-&gt;<a class="code" href="../../da/d3a/structSprite.html#a6150e0515f7202e2fb518f7206ed97dc">x</a> = 20;
<a name="l00007"></a>00007         aero_nave-&gt;<a class="code" href="../../da/d3a/structSprite.html#a0a2f84ed7838f07779ae24c5a9086d33" title="current sprite position">y</a> = (<a class="code" href="../../d9/dd9/SPRITE_8C.html#a02a30657228763729d9e2351a0b6bcba">VRES</a>/2);
<a name="l00008"></a>00008         aero_nave-&gt;<a class="code" href="../../da/d3a/structSprite.html#a90b9d56e145baae469f7b6bb757d9b27">xspeed</a> = 0;
<a name="l00009"></a>00009         aero_nave-&gt;<a class="code" href="../../da/d3a/structSprite.html#a8e19090b4aa5dd9bb43efe8b74488f6d" title="sprite current speed in the x and y direction">yspeed</a> = 0;  
<a name="l00010"></a>00010         
<a name="l00011"></a>00011         <span class="keywordflow">return</span> aero_nave;
<a name="l00012"></a>00012 }
<a name="l00013"></a>00013 
<a name="l00014"></a><a class="code" href="../../d8/da6/nave__feup_8c.html#ac6cd74d0d087a715fd2e9f779ba5ca40">00014</a> <span class="keywordtype">void</span> <a class="code" href="../../d8/da6/nave__feup_8c.html#ac6cd74d0d087a715fd2e9f779ba5ca40">desenha_nave</a>(<a class="code" href="../../da/d3a/structSprite.html">Sprite</a> *nave, <span class="keywordtype">char</span>* video_base)
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016         <a class="code" href="../../d4/d18/group__sprite.html#ga5c23ddc01d5d729ab434ae2dbb497d9b">draw_sprite</a>(nave, video_base);
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="../../d8/da6/nave__feup_8c.html#aeaf8b4c0384c2c7f0aac751d17f4e8ec">00019</a> <a class="code" href="../../da/d3a/structSprite.html">Sprite</a> *<a class="code" href="../../d8/da6/nave__feup_8c.html#aeaf8b4c0384c2c7f0aac751d17f4e8ec">desenha_tiro</a>(<span class="keywordtype">char</span>* video_base, <span class="keywordtype">int</span> posicao_y_nave, <span class="keywordtype">int</span> velocidade_x, <span class="keywordtype">int</span> width)
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021         <a class="code" href="../../da/d3a/structSprite.html">Sprite</a>* tiro = <a class="code" href="../../d4/d18/group__sprite.html#gac732cca247655c1bac63318eb29ffe7f">create_sprite</a>(<a class="code" href="../../db/d0a/pixmap__nave__feup_8h.html#abf86640d736b57c46f312c99863b1349">tiro_nave_feup</a>);
<a name="l00022"></a>00022         tiro-&gt;<a class="code" href="../../da/d3a/structSprite.html#a6150e0515f7202e2fb518f7206ed97dc">x</a> = 70;
<a name="l00023"></a>00023         tiro-&gt;<a class="code" href="../../da/d3a/structSprite.html#a0a2f84ed7838f07779ae24c5a9086d33" title="current sprite position">y</a> = (posicao_y_nave + 28);
<a name="l00024"></a>00024         tiro-&gt;<a class="code" href="../../da/d3a/structSprite.html#a90b9d56e145baae469f7b6bb757d9b27">xspeed</a> = velocidade_x;
<a name="l00025"></a>00025         tiro-&gt;<a class="code" href="../../da/d3a/structSprite.html#a8e19090b4aa5dd9bb43efe8b74488f6d" title="sprite current speed in the x and y direction">yspeed</a> = 0;
<a name="l00026"></a>00026                 
<a name="l00027"></a>00027         <span class="keywordflow">return</span> tiro;
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="../../d8/da6/nave__feup_8c.html#a1a8fe35afd2a1330ec39ef8c8fd823db">00030</a> <span class="keywordtype">void</span> <a class="code" href="../../d8/da6/nave__feup_8c.html#a1a8fe35afd2a1330ec39ef8c8fd823db">dispara_tiro</a>(<span class="keywordtype">char</span>* video_base, <span class="keywordtype">int</span> posicao_y_nave, <span class="keywordtype">int</span> velocidade_x, <span class="keywordtype">int</span> width, <a class="code" href="../../da/d3a/structSprite.html">Sprite</a> *tiro)
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032         <a class="code" href="../../d4/d18/group__sprite.html#ga5c23ddc01d5d729ab434ae2dbb497d9b">draw_sprite</a>(tiro, video_base);
<a name="l00033"></a>00033         <span class="keywordflow">while</span> (tiro-&gt;<a class="code" href="../../da/d3a/structSprite.html#a6150e0515f7202e2fb518f7206ed97dc">x</a> &lt; width)
<a name="l00034"></a>00034         {
<a name="l00035"></a>00035                 <a class="code" href="../../d4/d18/group__sprite.html#ga312c0a1681116fec27c3eedc167fde25">animate_sprite</a>(tiro, video_base);
<a name="l00036"></a>00036         }
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038 
</pre></div></div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Tudo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Estruturas de dados</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Ficheiros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Funções</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variáveis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Definições de tipos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Enumerações</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Valores da enumeração</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Gerado em Tue Jun 1 21:46:44 2010 para FEUP-Defender por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
